package com.maple.retry.manager.impl;

import com.maple.retry.manager.SendSmsManager;
import com.maple.retry.retrytask.enums.RetryTaskTypeEnum;
import com.maple.retry.retrytask.manager.RetryTaskManager;
import com.maple.retry.retrytask.model.RetryTaskContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: maple
 * @version: SendSmsManagerImpl.java, v 0.1 2020年12月28日 15:17 maple Exp $
 */
@Component
public class SendSmsManagerImpl implements SendSmsManager {

    @Autowired
    private RetryTaskManager retryTaskManager;

    @Override
    public String sendSms() {

        Map<String, String> map = new HashMap<>();
        map.put("userId", "123");
        map.put("content", "想打架");

        retryTaskManager.create("111", RetryTaskTypeEnum.RETRY_TASK_SEND_SMS.getCode(), RetryTaskContext.valueOf(map));

        return "SUCCESS";
    }
}
